import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';
import { SceneTag } from '../../scene-tags/entities/scene-tag.entity';
@Entity()
export class SceneList {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  creator: string;

  @Column()
  duration: number;

  @Column({
    type: 'timestamp without time zone',
    default: () => 'CURRENT_TIMESTAMP',
  })
  create_time: Date;

  @UpdateDateColumn({
    type: 'timestamp without time zone',
    default: () => 'CURRENT_TIMESTAMP',
  })
  update_time: Date;

  @Column('enum', { enum: ['person', 'group'] })
  role: string;

  @Column({ default: '未命名的场景项目' })
  description: string;

  @Column('simple-json', { default: '[]' })
  stage_title: Array<any>;

  @Column({ default: 0 })
  share: number;

  // 标识场景是公共场景还是个人场景
  @Column('enum', { enum: ['user', 'public'], default: 'user' })
  scene_type: string;
  
  // 项目标签
  @Column('json', { default: () => "'[]'" })
  scene_tags: SceneTag[];
  

  // 设置项目初始得默认地图风格
  @Column({ default: 'mapbox://styles/mapbox/satellite-v9' })
  map_style: string;

  // 设置项目初始默认分辨率
  @Column({ default: 1 })
  resolution: number;

  // 设置项目初始默认视角
  @Column('simple-json', {
    default: `{
      "lon": 102.97650354,
      "lat": 39.2567092245464,
      "zoom": 3.4812238,
      "pitch": 10.0716,
      "bearing": 0
    }`,
  })
  default_view: object;
}
